package com.gladlee.timeServer;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.gladlee.ACP.Atom;
import com.gladlee.ACP.AtomApp;
import com.gladlee.myACP.myAtomUser;
public class TimeServer extends AtomApp {
	public TimeServer(){
		atom=new Atom();
		user=new myAtomUser();
		atom.regUser(user);
		atom.work();
	}
	public TimeServer(Atom _atom,myAtomUser _user){
		super(_atom,_user);
	}
	@Override
	public void run(){
		while(true){
			try {
				Thread.sleep(3000);
				Date date=new Date();
				DateFormat dfmt=new SimpleDateFormat();
				String time=dfmt.format(date);
				this.user.putStringData("Time", time);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
	protected void init(){
	}
	public static void main(String[] args){
		TimeServer ts=new TimeServer();
		ts.run();
	}
}
